<?php
/**
 * Created by Zend Studio.
 * User: FDG348
 * Date: 2017/9/13
 * Time: 11:36
 */
namespace common\models;

use yii\db\ActiveRecord;

class ActivityMessage extends ActiveRecord{
    const STATUS_ENABLE = 1;
    const STATUS_DISABLE = 0;

    public static function tableName(){
        return '{{%activity_message}}';
    }

    public function rules(){
        return [
            ['use_flg','default','value'=>self::STATUS_DISABLE]
        ];
    }

    /**
     * @获取创建人
     */
    public function getCreator(){
        $userInfo = \common\helps\tools::getloginUserInfo();
        if($userInfo){
            $userName = $userInfo->userName;
        }else{
            $userName = '';
        }
        return $userName;
    }
    
    public function getActivityMessagePlus()
    {
        return $this->hasMany(ActivityMessagePlus::className(), ['activity_message_id'=>'id']);
    }
}